1. Field of the Invention
The present invention relates to a method and apparatus for differential coding for use in reducing an amount of data of a time series signal such as a video signal when recording and transmitting the signal.
2. Description of the Prior Art
Among coding apparatuses for coding a time series signal such as a video signal, there is an apparatus for reducing a redundancy on a time base. A representative example is Moving Picture Coding Experts Group (referred to as "MPEG" hereinafter) which is currently under energetic discussion for standardization. In MPEG, DCT (Discrete Cosine Transform) is utilized for compression of data in spatial directions, while inter-frame prediction and motion compensation are utilized for compression of data on the time base.
In the motion compensation, input image data is divided into a plurality of blocks each composed of 16.times.16 pixels and the reproduced image of the previous frame is shifted by a motion vector to achieve an inter-frame prediction. The motion vector is expressed by vector components in the horizontal and vertical directions and each component is individually coded. The range of existence of the motion vector value depends on the range of the motion compensation.
As a method of coding a motion vector, there is employed a variable-length coding technique in MPEG for converting a difference value between an object value to be currently coded and its adjacent motion vector value into a variable-length code. The variable-length coding method is adopted because it is considered that a difference value between an object value to be coded and its adjacent value is zero when in panning or in an area except for edges of a moving object. It is also considered that the difference value is small in zooming operation. By converting the difference value into a variable-length code, the amount of codes is reduced. In this method, by taking a difference value between an object value to be coded and its adjacent value, the range of existence of the difference value is expanded to a range two times as great as that of the motion vector value. However, the amount of code words can be reduced to about half by adopting an aliasing (or folding) coding method. The aliasing coding method is disclosed in CCITT Recommendation H. 261 `VIDEO CODEC FOR AUDIOVISUAL SERVICES AT p.times.64 Kbit/s (1990)`.
The following describes methods of composing code words according to the conventional differential coding method and aliasing coding method with reference to FIGS. 1 to 14 using Tables 7 to 9.
FIG. 11 shows a method of composing code words according to the conventional differential coding method. In FIG. 11, X represents an object value to be currently coded, P represents an adjacent value, D represents a value of difference between the value X to be coded and the adjacent value P (i.e., D=X-P), and Y represents a transmission value. The value to be coded ranges from -16 to +15.
First, when the adjacent value P is e.g. +5, the difference value D ranges from -21 to +10. Since the difference value D is directly used as a transmission value Y in the conventional differential coding method, the transmission value Y ranges from -21 to +10. In FIG. 11, a folded (or polygonal) line composed of solid lines (L1, L2) and dotted lines (L3, L4) represents the code length with respect to the base line Y. When the adjacent value is +5, the solid line portion (L1, L2) of the folded line represents the code length of the transmission value to be taken in the range of -21 to +10. In this case, a code having the shortest code length is assigned to the transmission value of 0, and a code having the second shortest code length is subsequently assigned to the next transmission value adjacent to the value of 0. Similarly, other codes are assigned in turn to the other transmission values in the order that the code length increases as the transmission value increases in distance from the transmission value of 0.
However, since the adjacent value P ranges from -16 to +15, the difference value D (=X-P) ranges from -31 to +31, and therefore the transmission value Y also ranges from -31 to +31. Consequently, in this case, 63 pieces of code words are necessary in number for the transmission values.
FIG. 12 shows another method of composing code words according to the conventional aliasing coding technique. In FIG. 12, similarly to FIG. 11, X represents a value to be coded, P represents an adjacent value, D represents a difference value between the value X to be coded and the adjacent value P, and Y represents a transmission value. The value to be coded ranges from -16 to +15.
First, when the adjacent value is, for example, 5, the difference value D ranges from -21 to +10. According to the aliasing coding method, the difference value D is not directly used as a transmission value Y. When the difference value D is equal to or greater than +16, a value obtained by subtracting a number of 32 from the difference value D is used as the transmission value Y. Otherwise, when the difference value D is smaller than -16, a value obtained by adding a number of 32 to the difference value D is used as the transmission value Y. Consequently, the transmission value Y ranges from -16 to +15. In this example of FIG. 12, when the difference value D is in the range of -17 to -21, a number of 32 is added to the difference value D to make the transmission value Y range from +15 to +11 in composing each code word.
In FIG. 12, the folded solid line shows the code length of the code words for the transmission value Y to be taken when the adjacent value P is +5. In this case, a code having the shortest code length is assigned to the transmission value of 0, and other codes are assigned in turn to the other transmission values in the order that the code length increases as the transmission value increases in distance from the transmission value of 0. With the above-mentioned arrangement of FIG. 12, the code words assigned as the transmission value to be taken is 32 in number, which is reduced to about half of that achieved according to the conventional differential coding method of FIG. 11.
The following describes a conventional differential coding apparatus based on the differential coding method adopted in MPEG utilizing the aliasing coding technique with reference to FIG. 13.
FIG. 13 shows a block diagram of a conventional differential coding apparatus, where reference numeral 131 denotes a delay unit, 132 a differentiation unit, 133 a transmission value conversion unit, and 134 a variable-length coding unit.
First, an adjacent value P is stored in the delay unit 131 with receipt of an object value X to be currently coded. In the above process, when no adjacent value exists in such a case of the first value or the like, the adjacent value P is set 0. Then, in the differentiation unit 132, a difference value D between the value X to be coded and the adjacent value P stored in the delay unit 131 is calculated according to the following equation: EQU D=X-P
Further, in the transmission value conversion unit 133, a transmission value Y is obtained according to the following equations: ##EQU1## Finally, in the variable-length coding unit 134, each transmission value Y is converted into a variable-length code by assigning a code word having the shorter code length to the transmission value having the smaller absolute value in accordance with a variable-length coding table as shown in Table 7. Table 7 is obtained by adding as shown in Table 7. Table 7 is obtained by adding a code having a value of -16 to the variable-length coding table employed in MPEG. Therefore, the value to be coded ranges from -16 to +15, while the difference value D ranges from -31 to +31. Meanwhile, the transmission value Y ranges from -16 to +15.
FIG. 14 shows a block diagram of a decoding apparatus for decoding a value coded by the conventional differential coding apparatus shown in FIG. 13. In FIG. 14, reference numeral 141 denotes a delay unit, 142 a variable-length decoding unit, 143 an adder unit, and 144 a transmission value inversion unit.
First, an adjacent value P is stored in the delay unit 141 with receipt of a value X to be processed. In the above process, when no adjacent value exists in such a case of the first value or the like, the adjacent value is set 0. Then in the variable-length decoding unit 142, a transmission value Y is obtained by decoding a variable-length coded data in accordance with the variable-length coding table shown in Table 7. Further in the adder unit 143, the sum value A of the transmission value Y and the adjacent value P stored in the delay means 141 is obtained according to the following equation: EQU A=Y+P
Finally, in the transmission value inversion unit 144, the value A is decoded to obtain a decoded value X according to the following equations: ##EQU2##
Table 8 shows the case where P=+5, while Table 9 shows the case where P=-12.
In Table 8, in the coding operation, since the difference value D is smaller than -16 (i.e., ranges from -21 to -17) when the value X to be coded ranges from -16 to -12, the transmission value Y is obtained by adding a number of 32 to the difference value D. Conversely in the decoding operation, since the sum value A is equal to or greater than +16 when the transmission value Y ranges from +11 to +15, a decoded value X output from the unit 144 is obtained by subtracting a number of 32 from the sum value A.
In Table 9 where P=-12, in the coding operation, since the difference value D is equal to or greater than +16 when the value X to be coded ranges from +4 to +15, the transmission value Y is obtained by subtracting a number of 32 from the difference value D. Conversely in the decoding operation, since the sum value A is smaller than -16 (i.e., ranges from -28 to -17) when the transmission value Y ranges from -16 to -5, a decoded value X is obtained by adding a number of 32 to the sum value A.
By utilizing the aliasing coding method, the range of existence of the transmission value Y can be reduced to half of that of the difference value D, which allows to dimensionally reduce the coding table for converting each difference value into a variable-length code.
However, in the conventional method and apparatus for differential coding utilizing the aliasing coding method described as above, the absolute value of the transmission value decreases according as the absolute value of the difference value increases in the range where the difference value exceeds the range in which the transmission value can exist, i.e., in the range where the aliasing is taking effect. Therefore, the above-mentioned arrangement has been accompanied by a problem that the coding efficiency reduces in using a variable-length coding table in which the code length is made shorter according as the transmission value reduces in absolute value.